from flask import Blueprint, render_template, request, redirect, url_for
from flask_login import current_user

file_tools_bp = Blueprint('file_tools', __name__)


@file_tools_bp.route('/')
def index():
    tools = [
        {
            'name': 'PDF转换器',
            'slug': 'pdf-converter',
            'description': 'PDF转Word、PDF合并/分割、PDF添加水印等功能',
            'icon': 'fa-file-pdf'
        },
        {
            'name': '音频转换',
            'slug': 'audio-converter',
            'description': '音频格式转换、音频剪辑、调整音质等功能',
            'icon': 'fa-file-audio'
        },
        {
            'name': '视频转换',
            'slug': 'video-converter',
            'description': '视频格式转换、视频压缩、调整分辨率等功能',
            'icon': 'fa-file-video'
        },
        {
            'name': '文档转换',
            'slug': 'document-converter',
            'description': 'Word、Excel、PPT等常用文档格式互转',
            'icon': 'fa-file-word'
        }
    ]
    return render_template('tools/file/index.html', tools=tools)


@file_tools_bp.route('/pdf-converter')
def pdf_converter():
    return render_template('tools/file/pdf_converter.html')


@file_tools_bp.route('/audio-converter')
def audio_converter():
    return render_template('tools/file/audio_converter.html')


@file_tools_bp.route('/video-converter')
def video_converter():
    return render_template('tools/file/video_converter.html')


@file_tools_bp.route('/document-converter')
def document_converter():
    return render_template('tools/file/document_converter.html') 